package com.wangp.proxy.staticproxy;

import com.wangp.proxy.entity.Man;
import com.wangp.proxy.entity.Me;

public class StaticProxy implements Man{

	private Man man ;
	
	public StaticProxy(Man man) {
		if(man.getClass()== Me.class){
			this.man = man ;
		}
	}
	private void before(){
		System.out.println("I am waiting a beautiful girl");
	}
	private void after(){
		System.out.println("I have a family with a beautiful girl");
	}
	
	@Override
	public void findGirl() {
		before();
		man.findGirl();
		after();
	}
	
	public static void main(String[] args) {
		Man man = new Me();
		StaticProxy StaticProxy = new StaticProxy(man);
		StaticProxy.findGirl();
	}

}
